package org.zfes.snowier.zbss.xzy.router.solution;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.solution.model.SolutionConfigRecord;
import org.zfes.snowier.zbss.xzy.biz.solution.service.ISolutionConfigRecordService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/manager/config")
public class SolutionConfigRecordController implements BaseController {

	
	@Autowired
	private ISolutionConfigRecordService solutionConfigRecordService;
	
	//@RequiresPermissions(value="solutionConfigRecord:loadSolutionConfigRecordDataSet",desc="解决方案配置记录列表")
    @RequestMapping(value="/loadSolutionConfigRecordDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadSolutionConfigRecordDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  solutionConfigRecordService.loadSolutionConfigRecordDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="solutionConfigRecord:createSolutionConfigRecord",desc="解决方案配置记录添加")
    @RequestMapping(value="/createSolutionConfigRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createSolutionConfigRecord(@RequestBody SolutionConfigRecord solutionConfigRecord){
		solutionConfigRecordService.createSolutionConfigRecord(solutionConfigRecord);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="solutionConfigRecord:loadSolutionConfigRecord",desc="解决方案配置记录加载")
    @RequestMapping(value="/loadSolutionConfigRecord/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadSolutionConfigRecord(@PathVariable("id")Long id){
		Optional<SolutionConfigRecord> ops = solutionConfigRecordService.loadSolutionConfigRecordById(id);
		return ajaxQuery("solutionConfigRecord",ops);
    }
	
	//@RequiresPermissions(value="solutionConfigRecord:updateSolutionConfigRecord",desc="解决方案配置记录更新")
    @RequestMapping(value="/updateSolutionConfigRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateSolutionConfigRecord(@RequestBody  SolutionConfigRecord solutionConfigRecord){
		solutionConfigRecordService.updateSolutionConfigRecord(solutionConfigRecord);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="solutionConfigRecord:deletSolutionConfigRecord",desc="解决方案配置记录删除")
    @RequestMapping(value="/deleteSolutionConfigRecord/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteSolutionConfigRecord(@PathVariable("id")Long id){
		solutionConfigRecordService.deleteSolutionConfigRecord(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadSolutionConfigRecordSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadSolutionConfigRecordSelectVo(){
		 List<SelectVo>  ops = solutionConfigRecordService.loadSolutionConfigRecordSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}